<template>
  <div>
    <CategorySelector :isDisabled="scene === 1" />
    <el-card>
      <SkuList
        v-if="scene === 1"
        @getScene="getScene"
        @getSpuInfo="getSpuInfo"
      ></SkuList>
      <SpuForm v-if="scene === 2" @getScene="getScene" :spu="spuInfo"></SpuForm>
      <SkuForm v-if="scene === 3" @getScene="getScene" :spu="spuInfo" @getSpuInfo="getSpuInfo"></SkuForm>
    </el-card>
  </div>
</template>

<script lang="ts">
import CategorySelector from '@/components/CategorySelector/index.vue'
import SkuList from './components/SpuList.vue'
import SpuForm from './components/SpuForm.vue'
import SkuForm from './components/SkuForm.vue'
export default {
  name: 'Spu',
  components: {
    CategorySelector,
    SkuList,
    SpuForm,
    SkuForm,
  },
}
</script>
<script lang="ts" setup>
import { ref } from 'vue'
const scene = ref(1)
const getScene = (val: number) => {
  scene.value = val
}
const spuInfo = ref()

const getSpuInfo = (val) => {
  spuInfo.value = {
    ...val,
    spuSaleAttrList: [],
    spuImageList: [],
  }
}
</script>

<style></style>
